Author: Halfvares Mats, Teknikhuset AB.

Published: 2004-08-10

Applies to: Content Studio ver. 4.0

Type: How to


Cause

More information

Normally there is not much need for server side includes in a Content Studio web. There are several workarounds: The Insert Script component allows to insert a block of ASP-code or you can create a custom component without parameters that inserts a well-tested block of server code in any page. If the include file does not contain a code block ex. it is a regular document footer you should not use server side includes in Content Studio. In this case the Insert document component is a far better solution.

If you would like a document in Content Studio to act as a server side include file you must create this file in a category that does not have meta data ex. Text without metadata. If you use the default file extension .ASP for this document it cannot use any encoding. However if the include file needs to be in the Unicode (UTF-8) format you should use the .VBS file extension and set the document's encoding to UTF-8. In this case the file content is stored in UTF-8 both in the file system and in Content Studio.

Also instead of using the ordinary <!-- #include directive you can use the more consistent <SCRIPT RUNAT="SERVER" SRC="Include.VBS" ></SCRIPT> where Include.VBS is the pathname of the file when stored on disk. This pathname is relative the main document ex. src="../../Global/Includes/AFDB3564-33A5-45AF-8AEA-1A1EC541E2C1.VBS". In this case you typically will write all your code as functions that you can call from anywhere in your code. However variables are not shared between the main page and the include page. Another advantage with using this method is that you can put the script block in the header properties field thus including the data in the header of the page.